﻿/*
NAILSUPERSTORE ® COMPANY
 
[HISTORY]
Created By  	: TRINH DANG KHOA
Created Date	: 11/26/2010
Modified By     :
Modified Date   :
Note            :

*/

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using CommonTagTime.DataAccess;
using CommonTagTime.ModelObject;
namespace CommonTagTime.Business
{
    public class busProduct
    {
        //------------------------------------------------
        //FIELD TABLE
        //------------------------------------------------
        public const string TABLE = "Product";
        public const string PRODUCTID = "ProductID";
        public const string SKU = "SKU";
        public const string NAME = "Name";
        public const string ISACTIVE = "IsActive";
        public const string WASPRICE = "WasPrice";
        public const string NOWPRICE = "NowPrice";
        public const string ISNEW = "IsNew";
        public const string SITE = "Site";
        public const string VIDEO = "Video";
        public const string ZONEID = "ZoneId";
        public const string SHORTDESCRIPTION = "ShortDescription";
        public const string DESCRIPTION = "Description";
        public const string METAKEYWORDS = "MetaKeywords";
        public const string METADESCRIPTION = "MetaDescription";
        public const string PAGETITLE = "PageTitle";
        public const string CREATEDBY = "CreatedBy";
        public const string CREATEDDATE = "CreatedDate";
        public const string UPDATEDBY = "UpdatedBy";
        public const string UPDATEDDATE = "UpdatedDate";
        public const string NOTEID = "NoteId";
        public const string STATUS = "Status";    
        public const string ORDERBY = "OrderBy";
        public const string ORDERDIRECTION = "OrderDirection";
        public const string CURRENTPAGE = "CurrentPage";
        public const string PAGESIZE = "PageSize";
        public const string CONDITION = "Condition";
        public const string TOTALRECORDS = "TotalRecords";
        public const string SIZE = "Size";
        public const string COLOR = "Color";
        public const string MATERIAL = "Material";
        public const string MADEIN = "MadeIn";

        private daoProduct daoProduct;
        //------------------------------------------------
        //PUBLIC
        //------------------------------------------------
        public busProduct()
        {
            daoProduct = new daoProduct();
        }

        public Product Detail(Product product)
        {
            return daoProduct.Detail(product);
        }

        public ProductCollection List(Product product)
        {
            return daoProduct.List(product);
        }

        public bool Active(int ProductID)
        {
            clsCacheUtil.RemoveCacheWithPrefix("Zone_");
            return daoProduct.Active(ProductID);
        }

        public bool DeActive(int ProductID)
        {
            clsCacheUtil.RemoveCacheWithPrefix("Zone_");
            return daoProduct.DeActive(ProductID);
        }

        public bool Delete(int ProductID)
        {
            clsCacheUtil.RemoveCacheWithPrefix("Zone_");
            return daoProduct.Delete(ProductID);
        }

        public Product GetByID(int ProductID)
        {
            if (ProductID <= 0)
                return null;
            return daoProduct.GetByID(ProductID);
        }

        public Product GetBySKU(string SKU)
        {
            return daoProduct.GetBySKU(SKU);
        }

        public int Insert(Product objProduct)
        {
            clsCacheUtil.RemoveCacheWithPrefix("Zone_");
            return daoProduct.Insert(objProduct);
        }

        public bool RemoveNew(int productId)
        {
            if (productId <= 0)
                return false;

            return daoProduct.RemoveNew(productId);
        }

        public bool SetNew(int productId)
        {
            if (productId <= 0)
                return false;
            return daoProduct.SetNew(productId);
        }

        public int Update(Product objProduct)
        {
            clsCacheUtil.RemoveCacheWithPrefix("Zone_");
            return daoProduct.Update(objProduct);
        }

        public ProductCollection GetListByCategoryID(Product objProduct)
        {
            return daoProduct.GetListByCategoryID(objProduct);
        }
        public ProductCollection GetListNewProduct()
        {
            return daoProduct.GetListNewProduct();
        }
        public ProductCollection GetRelatedForProduct(Product objProduct)
        {
            return daoProduct.GetRelatedForProduct(objProduct);
        }
        public ProductCollection GetListAll(Product objProduct)
        {
            return daoProduct.GetListAll(objProduct);
        }

        public ProductCollection Ads()
        {
            return daoProduct.Ads();
        }
    }

}